<?php

class ShopCardOutLog extends logCAr
{



	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/* reset db */
	public function getDbConnection()
	{
        self::$db=Yii::app()->db1;
	  if(self::$db instanceof CDbConnection) return self::$db;

	}
    public function tableName()
	{
		return '{{shop_card_out_log}}';
	}
	/* replace  */
	public function attributeLabels() //表单字段label,如不定义，默认使用字段名称做为label
	{

	}
	/* rules */
	public function rules() //返回属性的验证规则
	{
		return array(
			 array('name,channel_id', 'safe', 'on'=>'search'),
		);
	}



	public function primaryKey()
	{
		return 'id';
	}

	public function search($type = 0)
	{
		$criteria=new CDbCriteria;
        $criteria->order =  " id desc ";
        $criteria->compare("del_flag",0);
        $criteria->compare("channel_id",$this->channel_id);
        $criteria->compare("name",$this->name,true);
        return new CActiveDataProvider($this, array(
				'criteria'=>$criteria,
		));
	}
}
